﻿<shared:PageBase x:Class="Bymed.SpineScan.WPF.StartTestPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
      xmlns:userControl="clr-namespace:Bymed.SpineScan.WPF.CustomizedUserControl"
      xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="800" d:DesignWidth="1280"
	  Title="StartTestPage" Style="{StaticResource DefaultPageStyle}"
      DataContext="{Binding StartTest, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Width="1200">
        <Grid.RowDefinitions>
            <!-- Main Content -->
            <RowDefinition Height="Auto" />
            <!-- Navigation Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.Background>
                <ImageBrush ImageSource="/Skins/Resource/Image/GrayRightAboveTabBackground.png" />
            </Grid.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <!-- Page Title -->
                    <RowDefinition Height="70" />
                    <!-- TestItem Info -->
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Text="开始测试" Margin="0,12,45,0" HorizontalAlignment="Right" Style="{StaticResource PageTitleTextBlock}" />
                <StackPanel Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
                    <userControl:PatientBasicInfoDisplayUserControl DataContext="{Binding PatientBasicInfoDisplayViewModel}" 
                        Margin="0,-5,5,0" Width="229" Height="450" VerticalAlignment="Top" />
                    <Grid Height="460">
                        <Grid.ColumnDefinitions>
                            <!-- Test Items -->
                            <ColumnDefinition Width="Auto" />
                            <!-- Demo Flash -->
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <ListBox x:Name="ListBoxTestItems" BorderThickness="0" Background="Transparent" VerticalAlignment="Top" Height="440" 
                                 ItemsSource="{Binding TestItemList}">
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource TestItemListBoxItem}">
                                    <Setter Property="Tag" Value="{Binding}" />
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <interactivity:Interaction.Triggers>
                                <interactivity:EventTrigger EventName="SelectionChanged">
                                    <interactivity:InvokeCommandAction Command="{Binding SelectTestItemCommand}" 
                                                           CommandParameter="{Binding SelectedItem, ElementName=ListBoxTestItems}" />
                                </interactivity:EventTrigger>
                            </interactivity:Interaction.Triggers>
                        </ListBox>
                        <Border VerticalAlignment="Top" Grid.Column="1" BorderThickness="1" BorderBrush="#575656" CornerRadius="4" Height="440" Margin="30,0,0,0">
                            <Grid>
                                <Image VerticalAlignment="Top" Source="{Binding CurrentTestItemName, Converter={StaticResource TestItemDemoImageSourceConverter}}" Width="350" />
                                <TextBlock Margin="0,0,0,36" VerticalAlignment="Bottom" HorizontalAlignment="Center" 
                                           Foreground="Black" FontSize="32" Style="{StaticResource InfoTextBlock}" 
                                           Text="{Binding SelectedItem, ElementName=ListBoxTestItems, Converter={StaticResource CustomizedTestItemTitleConverter}}" />
                            </Grid>
                        </Border>
                    </Grid>
                </StackPanel>
            </Grid>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="上一步" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource NavigationButton}" Click="ButtonBack_Click" />
            <Button Content="取消" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Cancel.png" Style="{StaticResource NavigationButton}" Click="ButtonCancel_Click" />
            <Button Content="下一步" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource NavigationButton}" Command="{Binding NextCommand}" />
        </StackPanel>
    </Grid>
</shared:PageBase>
